import bb.cascades 1.2
import bb.WebImageView 1.4
import "../lib"

Padding {
    id: itemroot
    property int screenWidth
    property int height
    property int width
    property alias title: m_title.text
    property alias thumbnail: m_thumbnail.url
    property alias updateTime: m_updateTime.text
    property alias comments: m_comments.text

    layout: StackLayout {
        orientation: LayoutOrientation.TopToBottom
    }

    Divider {
        topMargin: 0
        bottomMargin: 0
        opacity: 0.0
    }

    Container {
        layout: AbsoluteLayout {
        }

        Container {
            WebImageView {
                id: m_thumbnail
                scalingMethod: ScalingMethod.AspectFill
                preferredWidth: width
                preferredHeight: height
            }
        }

        Padding {
            layoutProperties: AbsoluteLayoutProperties {
                positionX: width + 10
            }

            preferredWidth: screenWidth - width - 10

            layout: StackLayout {
                orientation: LayoutOrientation.TopToBottom
            }

            Container {
                Label {
                    id: m_title
                    multiline: true
                    textStyle.base: com.titleStyle
                }
            }

            Container {
                visible: false
                Label {
                    id: m_comments
                    textStyle.base: com.descStyle
                }
            }

            Container {
                Label {
                    id: m_updateTime
                    textStyle.base: com.descStyle
                }
            }
        }
    }
    
    Common {
        id: com
    }
}
